package com.zy.nettypoject.netty.netty;

import io.netty.channel.DefaultEventLoop;
import io.netty.channel.DefaultEventLoopGroup;
import io.netty.channel.EventLoop;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.util.NettyRuntime;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.util.concurrent.TimeUnit;

@Slf4j
public class TestEventLoop {
    public static void main(String[] args) {
        EventLoopGroup el = new NioEventLoopGroup(2);

        el.submit(() -> {

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            log.debug("sub_Thread");
        });

        //设置定时任务线程 做keeplive
        el.scheduleAtFixedRate(() -> {
            log.debug("sub---");
        },0,1, TimeUnit.SECONDS);


        log.debug("main_Thread");
    }

}
